<#if imPackage??>
package ${imPackage};
</#if>

<#list imports as imp>
import  ${imp};
</#list>
import java.util.List;
<#if (open_spring_annotate?string("1","0"))=="0">
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
</#if>
<#if (open_spring_annotate?string("1","0"))=="0">
@Service("${javaname?uncap_first}Servic")
</#if>
public class ${javaname}ServiceImpl implements ${javaname}Service {
<#if (open_spring_annotate?string("1","0"))=="0">
@Autowired
</#if>
 private ${javaname}Mapper ${javaname?uncap_first}Mapper;

<#assign i = "0">
<#list tableEntity.columnEntitys as iskey>
    <#if iskey.COLUMN_KEY=true>
        <#list tabname_javaname_map?keys as key>
        <#list columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]]?keys as iname>
        <#if i="0">
   public int deleteByPrimaryKey(${iname} ${tabname_javaname_map[iskey.COLUMN_NAME]}){
          return ${javaname?uncap_first}Mapper.deleteByPrimaryKey(${tabname_javaname_map[iskey.COLUMN_NAME]});
        }
        </#if>
            <#assign i = "2">
        </#list>
    </#list>
    </#if>
</#list>


   public int insert(${javaname} record){
    return ${javaname?uncap_first}Mapper.insert(record);
    }

   public int insertSelective(${javaname} record){
    return ${javaname?uncap_first}Mapper.insertSelective(record);
    }

/**
*批量修改可能用的少暂时不添加目前和mybatis一致
*/


   public int updateByPrimaryKeySelective(${javaname} record){
    return ${javaname?uncap_first}Mapper.updateByPrimaryKeySelective(record);
    }

   public int updateByPrimaryKey(${javaname} record){
    return ${javaname?uncap_first}Mapper.updateByPrimaryKey(record);

    }
      /**
      *根据主键批量删除
      *@param keys
      */
<#assign i = "0">
<#list tableEntity.columnEntitys as iskey>
    <#if iskey.COLUMN_KEY=true>
        <#list tabname_javaname_map?keys as key>
            <#list columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]]?keys as iname>
                <#list columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]]?keys as pt>
                    <#if i="0">
       public int deleteByPrimaryKeys(List<${columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]][pt]}> keys){
                    return ${javaname?uncap_first}Mapper.deleteByPrimaryKeys(keys);
                    }
                    </#if>
                    <#assign i = "2">
                </#list>
            </#list>
        </#list>
    </#if>
</#list>

<#--详细增删改方法-->
<#if isdetailed=true>
    <#list tableEntity.columnEntitys as iskey>
        <#if iskey.COLUMN_KEY=false>
        /**
        *根据对象中${tabname_javaname_map[iskey.COLUMN_NAME]}删除
        *@param entitys 需要删除的对象
        */
        public  int deleteBy${tabname_javaname_map[iskey.COLUMN_NAME]}(List<${javaname}> entitys){
            return ${javaname?uncap_first}Mapper.deleteBy${tabname_javaname_map[iskey.COLUMN_NAME]}(entitys);
        }
        </#if>
    </#list>
<#--修改方法-->
    <#list tableEntity.columnEntitys as iskey>
        /**
        *根据对象中${tabname_javaname_map[iskey.COLUMN_NAME]}修改
        *@param entitys 需要修改的对象
        */
       public void updateBy${tabname_javaname_map[iskey.COLUMN_NAME]}(List<${javaname}> entitys){
        ${javaname?uncap_first}Mapper.updateBy${tabname_javaname_map[iskey.COLUMN_NAME]}(entitys);
    }
    </#list>
<#--批量增加方法-->
        /**
        *批量增加方法
        *@param entitys 增加的对象
        */
      public  void inserts(List<${javaname}> entitys){
    ${javaname?uncap_first}Mapper.inserts(entitys);
        }
/**
*比mapp生成多的方法
*/
    <#assign i0 = "0">
    <#list tableEntity.columnEntitys as iskey>

                    <#list columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]]?keys as pt>
                        <#if i0="0">
                            <#assign i0 = "2">
                        <#else>
       public int deleteByPrimary${tabname_javaname_map[iskey.COLUMN_NAME]}(List<${columnnameandtypemap[tabname_javaname_map[iskey.COLUMN_NAME]][pt]}> ${tabname_javaname_map[iskey.COLUMN_NAME]}){
                                  ${javaname}Example ${" "+javaname?uncap_first}Example = new ${javaname}Example();
                            ${javaname}Example.Criteria criteria = ${" "+javaname?uncap_first}Example.createCriteria();
           criteria.and${tabname_javaname_map[iskey.COLUMN_NAME]}In(${tabname_javaname_map[iskey.COLUMN_NAME]});
           return equipmentMapper.deleteByExample(${javaname?uncap_first}Example);
                        }
                        </#if>
                    </#list>
            </#list>
</#if>
    }